﻿import React, { Component } from 'react';
import PropTypes from 'prop-types';
import './common.css';
import './Expandable.css'
import Checkable from './Checkable';

export default class Expandcheckable extends Component {
    static propTypes = {
        text: PropTypes.string.isRequired,
        expanded: PropTypes.bool,
        onExpand: PropTypes.func.isRequired,
        checked: PropTypes.bool,
        onCheck: PropTypes.func,
    }
    render() {
        return <div className='hflex'>
            <div className='expand-box' onClick={this.props.onExpand}>
                {this.props.expanded ? '-' : '+'}
            </div>
            <Checkable
                text={this.props.text}
                checked={this.props.checked}
                onCheck={this.props.onCheck} />
        </div>
    }
}